Macromedia Flex Article

Learning Flex Basics (Part 2): Creating a Simple Calculator with Macromedia Flex


Table of Contents

  1. Introduction
  2. Building the Calculator
  3. Create the Application Object
  4. Add a Panel for the Calculator
  5. Add the Calculator Display
  6. Add a Grid to Lay Out the Buttons
  7. Add the Calculator Buttons
  8. Create the CalculatorController Class
  9. Add Properties to the Controller Class
  10. Add Controller Methods
  11. Instantiate the CalculatorController Class
  12. Complete Code Listing for calculator.mxml
  13. Complete Code Listing for CalculatorController.as
  14. Where to Go From Here

Where to Go from Here

Although the calculator you have built here is simple, it works, and if you actually need to build a calculator of some kind, you could easily extend this one to include additional functionality. ActionScript includes a static Math class whose methods would do a lot of the work for you. More importantly, though, you should feel comfortable now with basic elements of MXML and ActionScript, and ready to start tackling more sophisticated applications.

Continue on to the following tutorials to learn more:

If you prefer, you can download the entire set of tutorials, Learning Flex Series (Parts 1-4). If you like what you see and want to get more experience with Flex, Macromedia Customer Training offers Fast Track to Macromedia Flex, a two-day onsite training course to jump-start Flex development in your organization. You should also look at the informative set of sample applications in included with Flex; these illustrate the use of many Flex features.